<template>
	<view class="point_box flex flex-column"  :style="colorStyle">
		<view class="flex align-center jc-sa fw500 team_box">
			<view>今日奖励：{{count}}</view>
			<view>总奖励：{{all_sum}}</view>
		</view>
		
		<view style="background: #FFFFFF;
border-radius: 14rpx;margin: 26rpx;padding: 12rpx;">
			<view 
				style="padding: 30rpx 28rpx; border-bottom:  1rpx solid #E6E6E6;display: flex;justify-content: space-between;align-items: center;"
				v-for="(item, index) in greenlist" :key="index">
				<view>
					<view style="margin-bottom: 15rpx;color: #686868;font-size: 28rpx;">{{item.title}}</view>
					<view style="font-weight: 500;color: #9E9E9E;font-size: 24rpx;margin-bottom: 8rpx;">订单编号：{{item.order_sn}}</view>
					<view style="font-weight: 500;color: #9E9E9E;font-size: 24rpx;">操作时间：{{item.add_time}}</view>
				</view>
				<view v-if="reward_type!=0" style="color: #E93323;font-weight: bold;
font-size: 36rpx;">+{{item.number}}</view>
<view v-else style="color: #008f00;font-weight: bold;
font-size: 36rpx;">-{{item.number}}</view>
				<!-- <button :disabled="item.receive==1" style="font-size: 28rpx;font-weight: 500;
color: #FFFFFF;padding:10rpx 0; width: 172rpx;
border-radius: 16rpx;" :style="item.receive?'background:#686868;':'background: #E93323;'" @click="receivebtn(item.id)">{{item.receive?'已领取':'立即领取'}}</button> -->
			</view>
			<u-loadmore :status="status" />
		</view>
		<!-- #ifndef MP -->
		<home></home>
		<!-- #endif -->
	</view>
</template>

<script>
	var that;
	import home from '@/components/home';
	import {
		getCommissionInfo
	} from '@/api/user.js';
	export default {
		components: {
			home,
		
		},
		data() {
			return {
				greenlist:[{},{}],
				reward_type:'',
				page: 1,
				limit: 10,
				status: 'loadmore',
				page: 1,
				pages:'',
				count:'0.00',
				all_sum:'0.00'
			}
		},
		onLoad(e) {
			that = this
			console.log('e=',e)
			that.reward_type=e.reward_type
			  uni.setNavigationBarTitle({
			                               title:e.title,
			                               success: () => {
			                                   console.log('修改标题成功')
			                               },
			                               fail: () => {
			                                   console.log('修改标题失败')
			                               },
			                               complete: () => {
			                                   console.log('修改标题结束')
			                               },
			                           })      
			that.getgreenlist()
		},
			onReachBottom() {
				console.log('that.pages.length',this.pages.length)
					if(this.pages.length < this.limit) return ;
					this.status = 'loading';
					this.page = ++ this.page;
					this.getgreenlist()
				},
		methods: {
		
			getgreenlist(){
				getCommissionInfo({
					reward_type:that.reward_type,
					page: that.page,
					limit: that.limit
				},3).then(res => {
					let data = res.data
					that.pages=res.data.list
					this.all_sum=data.all_sum
					this.count=data.today_sum
					if(that.page==1){
						that.greenlist=data.list
					}else{
						that.greenlist = that.greenlist.concat(data.list);
					}
					if(that.pages.length < that.limit) that.status = 'nomore';
					else that.status = 'loading';
					console.log('that.greenlist',that.greenlist)
				});
			}
		}

	}
</script>

<style scoped lang="scss">
	.point_box {
		 // height: 100vh;

		.team_box {
			height: 100rpx;
			background: #E93323;
			font-size: 28rpx;
			color: #FFFFFF;
		}

		.reward_box {
			height: 184rpx;
			background: #FFFFFF;
			border-radius: 14rpx;
			margin: 30rpx 26rpx 52rpx 26rpx;
			text-align: center;

			.reward_num {
				margin-bottom: 15rpx;
				font-size: 36rpx;
				font-weight: 500;
				color: #E93323;
			}

			.reward_tit {
				font-size: 32rpx;
				font-weight: 500;
				color: #686868;
			}
		}
	}

	.flex {
		display: flex;
	}

	.flex-column {
		flex-flow: column;
	}

	.align-center {
		align-items: center;
	}

	.jc-sa {
		justify-content: space-around;
	}

	.fw500 {
		font-weight: 500;
	}
</style>